#!/bin/bash

<udf name="user" label="Non Root User"
    default=""
    example="billgates">
<udf name="userpassword" label="Non Root User Password">
<udf name="hostname" label="Linode Hostname" >

apt-get update
apt-get upgrade
apt-get install \
     apache2 \
     php5 \
     php5-cli \
     php5-common \
     php5-curl \
     php5-dev \
     php5-gd \
     php5-imap \
     php5-mcrypt\
     php5-mysql  \
     php5-pgsql \
     mysql-server \
     acl

cd /etc/apache2/sites-available/
wget https://code.google.com/p/tgsf/source/browse/sample_apps/apache-configs/sites-available/default
wget https://code.google.com/p/tgsf/source/browse/sample_apps/apache-configs/sites-available/default-ssl
wget https://code.google.com/p/tgsf/source/browse/sample_apps/apache-configs/sites-available/virtual-document-roots

mkdir /home/www/
mkdir /home/www/default
mkdir /home/www/sites/

setfacl -dRm 'u:www-data:rx' /home/www
setfacl -Rm 'u:www-data:rx' /home/www

a2ensite default
a2ensite virtual-document-roots

a2enmod rewrite
a2enmod vhost_alias
a2enmod ssl
service apache2 restart